<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增商品</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/css/common.css" media="all">
</head>
<link rel="stylesheet" href="/js/layui/css/layui.css" media="all">
<script src="/js/layui/layui.all.js"></script>
<style type="text/css">

    .formbox {
        height: 1px;
    }

    body {
        background-color: white;
    }
    .edui-editor{
        width: 100% !important;
    }
    #edui1{
        z-index: 0 !important;
    }
    .layui-input-block{
        margin-left: 120px !important;
    }
    .layui-form-label{
        width: auto;
    }
    .layui-form-select dl{
        top: auto;
        bottom: 36px;
    }
</style>
<body>
<div style="width:80%;height:100%;margin:15px auto;text-align: center" class="layui-btn-group" id="btngroup">
    <button type="button" id="btnchina" class="layui-btn layui-btn-primary" onclick="clickbtn(0)">中文</button>
    <button type="button" id="btnenglish" class="layui-btn layui-btn-primary" onclick="clickbtn(1)">英语</button>
    <!--    泰语-->
    <button type="button" id="btnlaowo" class="layui-btn " onclick="clickbtn(2)">泰语</button>
    <button type="button" id="btnjianpuzhai" class="layui-btn layui-btn-primary" onclick="clickbtn(3)">柬埔寨</button>
</div>
<div class="layui-row">
    <div class="layui-col-md2  formbox ">
    </div>

    <div class="layui-fluid layui-col-sm8 ">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 15px;" class="layui-row">
                <form class="layui-form" action="">
                    <div class="layui-form-item" id="gName_div" style="display: none">
                        <label class="layui-form-label" >商品名称:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gName" id="gName"  placeholder="请输入商品名称"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gName_en_div" style="display: none">
                        <label class="layui-form-label" >英语商品名称:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gName" id="gName_en"  placeholder="请输入英语商品名称"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gName_tai_div" >
                        <label class="layui-form-label">泰语商品名称:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gName" id="gName_tai" required lay-verify="gName" placeholder="请输入泰语商品名称"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gName_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨名称:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gName_kh" id="gName_kh"  placeholder="请输入商品的柬埔寨名称"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" >商品图片:</label>
                        <div class="layui-input-block" id="icon_div" style="width: 100px;height: 100px">
                            <input style="display: none" type="text" id="icon_input" name="gPicture" value=""/>
                            <img class="test" style="width: 100px;height: 100px;" id="icon" src="/image/no.jpg"/>
                        </div>
                        <span style="font-size: 14px;color: red;margin-left: 110px">建议图片高宽比为1:1，例如200*200</span>
                    </div>

                    <div class="layui-form-item" id="uploadDiv" style="display: none">
                        <label class="layui-form-label" >中文商品轮播图</label>
                        <div class="layui-input-block">
                            <div style="float: left;">
                                <div>
                                    <img src="/image/no.jpg" id="image0" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px" class="aaa">
                                    <button type="button" class="layui-btn layui-btn-xs" id="upload0" lay-data="{index:'0'}"
                                            style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del0"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>

                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image1" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload1"
                                            lay-data="{index:'1'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del1"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image2" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload2"
                                            lay-data="{index:'2'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del2"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image3" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload3"
                                            lay-data="{index:'3'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del3"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image4" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload4"
                                            lay-data="{index:'4'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del4"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <span style="font-size: 14px;color: red;margin-left: 20px" >建议图片的高宽比为 1 : 1.8，例如200*360 </span>
                        </div>
                    </div>

                    <div class="layui-form-item" id="uploadDiv_en" style="display: none">
                        <label class="layui-form-label" >英语商品轮播图</label>
                        <div class="layui-input-block">
                            <div style="float: left">
                                <div>
                                    <img src="/image/no.jpg" id="image5" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px" class="aaa">
                                    <button type="button" class="layui-btn layui-btn-xs" id="upload5" lay-data="{index:'0'}"
                                            style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del5"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>

                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image6" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload6"
                                            lay-data="{index:'1'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del6"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image7" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload7"
                                            lay-data="{index:'2'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del7"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image8" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload8"
                                            lay-data="{index:'3'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del8"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image9" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload9"
                                            lay-data="{index:'4'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del9"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <span style="font-size: 14px;color: red;margin-left: 20px" >建议图片的高宽比为 1 : 1.8，例如200*360 </span>
                        </div>

                    </div>

                    <div class="layui-form-item" id="uploadDiv_tai" >
                        <label class="layui-form-label" >泰语商品轮播图</label>
                        <div class="layui-input-block">
                            <div style="float: left">
                                <div>
                                    <img src="/image/no.jpg" id="image10" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px" class="aaa">
                                    <button type="button" class="layui-btn layui-btn-xs" id="upload10" lay-data="{index:'0'}"
                                            style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del10"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>

                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image11" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload11"
                                            lay-data="{index:'1'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del11"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image12" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload12"
                                            lay-data="{index:'2'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del12"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image13" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload13"
                                            lay-data="{index:'3'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del13"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image14" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload14"
                                            lay-data="{index:'4'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del14"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <span style="font-size: 14px;color: red;margin-left: 20px" >建议图片的高宽比为 1 : 1.8，例如200*360 </span>
                        </div>

                    </div>

                    <div class="layui-form-item" id="uploadDiv_kh" style="display: none">
                        <label class="layui-form-label" >柬埔寨轮播图</label>
                        <div class="layui-input-block">
                            <div style="float: left">
                                <div>
                                    <img src="/image/no.jpg" id="image15" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px" class="aaa">
                                    <button type="button" class="layui-btn layui-btn-xs" id="upload15" lay-data="{index:'0'}"
                                            style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del15"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>

                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image16" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload16"
                                            lay-data="{index:'1'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del16"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image17" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload17"
                                            lay-data="{index:'2'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del17"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image18" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload18"
                                            lay-data="{index:'3'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del18"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <div style="float: left;margin-left:20px;">
                                <div>
                                    <img src="/image/no.jpg" id="image19" style="width: 108px;height: 60px;cursor:pointer">
                                </div>
                                <div style="width: 15px">
                                    <button type="button" class="layui-btn layui-btn-xs " id="upload19"
                                            lay-data="{index:'4'}" style="margin-top: 10px;margin-left: 25px" >
                                        <i class="layui-icon">&#xe67c;</i>上传
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-xs" id="del19"
                                            style="margin-top: 10px;margin-left: 25px;display: none" >
                                        <i class="layui-icon">&#xe67c;</i>删除
                                    </button>
                                </div>
                            </div>
                            <span style="font-size: 14px;color: red;margin-left: 20px" >建议图片的高宽比为 1 : 1.8，例如200*360 </span>
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" id="state_title" >所选类型:</label>
                        <div class="layui-input-block">
                            <input id="superior_id" disabled value="" type="text"
                                   placeholder="请选择商品类型"
                                   autocomplete="off" class="layui-input">
                            <input id="gtype" type="text" style="display: none" value="" name="gtype">
                        </div>
                    </div>

                    <div id="superior_id_div">
                        <span style="font-size: 14px;color: red;margin-left: 110px" >只能选择第三级类别</span>
                        <div id="xx" style="margin:10px 110px;border:10px solid black;">
                        </div>
                    </div>

                    <div class="layui-form-item" id="guige_div">
                        <label class="layui-form-label" >规格:</label>
                        <div class="layui-input-block" style="display:flex;">
                            <div class="layui-btn" onclick="edite_guige(0)" ><i class="layui-icon layui-icon-edit" ></i>编辑规格</div>
                            <div id="guige_msg0" style="color:red;line-height:40px;margin-left:15px;" >
                                未填写
                            </div>
                            <div style="line-height:40px;margin-left:10px;"><a style="color:blue;" onclick="clear_guige(0)" href="javascript:void(0)" >清空规格数据</a></div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品权重:</label>
                        <div class="layui-input-block">
                            <input name="weights" type="number" min="0" max="999999999" placeholder="商品权重，只能输入正整数" id="weights" required lay-verify="weights" placeholder="商品权重数字" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
                        </div>
                    </div>
<!--                    <div class="layui-form-item" id="guige_en_div" style="display: none">-->
<!--                        <label class="layui-form-label" >Specification:</label>-->
<!--                        <div class="layui-input-block" style="display:flex;">-->
<!--                            <div class="layui-btn" onclick="edite_guige(1)" ><i class="layui-icon layui-icon-edit" ></i>Edit specifications</div>-->
<!--                            <div id="guige_msg1" style="color:red;line-height:40px;margin-left:15px;" >-->
<!--                                not filled-->
<!--                            </div>-->
<!--                            <div style="line-height:40px;margin-left:10px;"><a style="color:blue;" onclick="clear_guige(1)" href="javascript:void(0)" >Specification data removal</a></div>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                    <div class="layui-form-item" id="guige_tai_div" style="display: none">-->
<!--                        <label class="layui-form-label" >ข้อมูลจำเพาะ:</label>-->
<!--                        <div class="layui-input-block" style="display:flex;">-->
<!--                            <div class="layui-btn" onclick="edite_guige(2)" ><i class="layui-icon layui-icon-edit" ></i>แก้ไขข้อมูลจำเพาะ</div>-->
<!--                            <div id="guige_msg2" style="color:red;line-height:40px;margin-left:15px;" >-->
<!--                                ไม่ได้กรอก-->
<!--                            </div>-->
<!--                            <div style="line-height:40px;margin-left:10px;"><a style="color:blue;" onclick="clear_guige(2)" href="javascript:void(0)" >ล้างข้อมูล</a></div>-->
<!--                        </div>-->
<!--                    </div>-->

                    <div class="layui-form-item">
                        <label class="layui-form-label" >商品库存:</label>
                        <div class="layui-input-block">
                            <input name="gKucun" type="text" placeholder="商品库存，只能输入正整数" id="gKucun" required lay-verify="gKucun" placeholder="商品库存" autocomplete="off" class="layui-input" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
                        </div>
                    </div>

                    <div class="layui-form-item" id="yuanjia_div" style="display: none">
                        <label class="layui-form-label" >人民币原价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="originalPrice" id="originalPrice" required lay-verify="originalPrice" style="display: inline;width: 35%"
                                   placeholder="人民币原价，以人民币为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                        </div>
                    </div>
                    <div class="layui-form-item" id="yuanjia_en_div" style="display: none">
                        <label class="layui-form-label" >美元原价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="originalPrice_en" id="originalPrice_en" required lay-verify="originalPrice_en" style="display: inline;width: 35%"
                                   placeholder="美元原价，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                        </div>
                    </div>
                    <div class="layui-form-item" id="yuanjia_tai_div">
                        <label class="layui-form-label" >泰文版原价($):</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="originalPrice_tai" id="originalPrice_tai" required lay-verify="originalPrice_tai" style="display: inline;width: 35%"
                                   placeholder="泰文版原价，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                        </div>
                    </div>
                    <div class="layui-form-item" id="yuanjia_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨原价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="originalPrice_en" id="originalPrice_kh" required lay-verify="originalPrice_en" style="display: inline;width: 35%"
                                   placeholder="柬埔寨原价，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                        </div>
                    </div>

                    <div class="layui-form-item" id="price_div" style="display: none">
                        <label class="layui-form-label" >人民币折扣价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="gPrice" id="gPrice" required lay-verify="gPrice" style="display: inline;width: 35%"
                                   placeholder="人民币折扣价，以人民币为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">中文计量单位：</span>
                            <input type="text" name="gDanwei" id="gDanwei" placeholder="计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="price_en_div" style="display: none">
                        <label class="layui-form-label" >美元折扣价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="gPrice_en" id="gPrice_en" required lay-verify="gPrice_en" style="display: inline;width: 35%"
                                   placeholder="美元折扣价，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">英文计量单位：</span>
                            <input type="text" name="gDanwei_en" id="gDanwei_en" placeholder="英语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="price_tai_div">
                        <label class="layui-form-label" >泰文版折扣价($):</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="gPrice_tai" id="gPrice_tai" required lay-verify="gPrice_tai" style="display: inline;width: 35%"
                                   placeholder="泰文版折扣价，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">泰语计量单位：</span>
                            <input type="text" name="gDanwei_tai" id="gDanwei_tai" placeholder="泰语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="price_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨折扣价:</label>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="gPrice_kh" id="gPrice_kh" required lay-verify="gPrice_kh" style="display: inline;width: 35%"
                                   placeholder="柬埔寨价格，以美元为单位" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">柬埔寨计量单位：</span>
                            <input type="text" name="gDanwei_kh" id="gDanwei_kh" placeholder="柬埔寨计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>

                    <div class="layui-form-item" id="grabPrice_div" style="display: none;position: relative">
                        <label class="layui-form-label" >抢购价（￥）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPrice" id="grabPrice" required lay-verify="grabPrice" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位人民币" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">抢购价单位：</span>
                            <input type="text" name="grabPriceDanwei" id="grabPriceDanwei" placeholder="计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPrice_en_div" style="display: none;position: relative">
                        <label class="layui-form-label" >抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPrice_tai" id="grabPrice_en" required lay-verify="grabPrice_en" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">美元抢购价单位：</span>
                            <input type="text" name="grabPriceDanwei_en" id="grabPriceDanwei_en" placeholder="英语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPrice_tai_div" style="position: relative">
                        <label class="layui-form-label" >抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPrice_tai" id="grabPrice_tai" required lay-verify="grabPrice_tai" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">抢购价单位：</span>
                            <input type="text" name="grabPriceDanwei_tai" id="grabPriceDanwei_tai" placeholder="泰语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPrice_kh_div" style="display: none;position: relative">
                        <label class="layui-form-label" >抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPrice_kh" id="grabPrice_kh" required lay-verify="grabPrice_kh" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">抢购价单位：</span>
                            <input type="text" name="grabPriceDanwei_kh" id="grabPriceDanwei_kh" placeholder="柬埔寨计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>


                    <div class="layui-form-item" id="grabPriceSecond_div" style="display: none;position: relative">
                        <label class="layui-form-label" >第二抢购价（￥）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPriceSecond" id="grabPriceSecond" required lay-verify="grabPrice" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位人民币" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">抢购价单位：</span>
                            <input type="text" name="grabPriceSecondDanwei" id="grabPriceSecondDanwei" placeholder="计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPriceSecond_en_div" style="display: none;position: relative">
                        <label class="layui-form-label" >第二抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPriceSecond_en" id="grabPriceSecond_en" required lay-verify="grabPrice_en" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">美元抢购价单位：</span>
                            <input type="text" name="grabPriceSecondDanwei_en" id="grabPriceSecondDanwei_en" placeholder="英语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPriceSecond_tai_div" style="position: relative">
                        <label class="layui-form-label" >第二抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPriceSecond_tai" id="grabPriceSecond_tai" required lay-verify="grabPrice_tai" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">抢购价单位：</span>
                            <input type="text" name="grabPriceSecondDanwei_tai" id="grabPriceSecondDanwei_tai" placeholder="泰语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>
                    <div class="layui-form-item" id="grabPriceSecond_kh_div" style="display: none;position: relative">
                        <label class="layui-form-label" >第二抢购价（$）:</label>
                        <span style="margin-left: 20px;position: absolute;top: 30px;left: -0px;color: #999999" >选填<a style="color: #999999" onmouseover="show_tips_grabprice(this)"><i class="layui-icon">&#xe607;</i></a></span>
                        <div class="layui-input-block">
                            <input type="number" min="0" max="10000000" name="grabPriceSecond_kh" id="grabPriceSecond_kh" required lay-verify="grabPrice_kh" style="display: inline;width: 35%"
                                   placeholder="请输入商品抢购价，单位美元" autocomplete="off" class="layui-input" onblur="value=value.replace(/^(\-)^(\.)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
                            <span style="margin-left: 20px">美元抢购价单位：</span>
                            <input type="text" name="grabPriceSecondDanwei_kh" id="grabPriceSecondDanwei_kh" placeholder="英语计量单位，例如：个，瓶，箱，台，桶..." autocomplete="off" class="layui-input" style="display: inline;width: 35%">
                        </div>
                    </div>


                    <div class="layui-form-item" id="chandi_div" style="display: none">
                        <label class="layui-form-label" >产地:</label>
                        <div class="layui-input-block">
                            <input type="text" name="chandi" id="chandi" placeholder="产地" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="chandi_en_div" style="display: none">
                        <label class="layui-form-label" >英语产地:</label>
                        <div class="layui-input-block">
                            <input type="text" name="chandi_en" id="chandi_en" placeholder="英语产地" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="chandi_tai_div">
                        <label class="layui-form-label" >泰语产地:</label>
                        <div class="layui-input-block">
                            <input type="text" name="chandi_tai" id="chandi_tai" required
                                   lay-verify="chandi"
                                   placeholder="泰语产地" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="chandi_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨产地:</label>
                        <div class="layui-input-block">
                            <input type="text" name="chandi_kh" id="chandi_kh" placeholder="柬埔寨产地" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item" id="gPinpai_div" style="display: none">
                        <label class="layui-form-label" >品牌:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gPinpai" id="gPinpai" placeholder="品牌" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gPinpai_en_div" style="display: none">
                        <label class="layui-form-label" >英语品牌:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gPinpai_en" id="gPinpai_en" placeholder="英语品牌" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gPinpai_tai_div" >
                        <label class="layui-form-label" >泰语品牌:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gPinpai_tai" id="gPinpai_tai" required
                                   lay-verify="gPinpai"
                                   placeholder="泰语品牌" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gPinpai_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨品牌:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gPinpai_kh" id="gPinpai_kh" required
                                   lay-verify="gPinpai_kh"
                                   placeholder="输入品牌的柬埔寨名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item" id="gJianjie_div" style="display: none">
                        <label class="layui-form-label" >简介:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gJianjie" id="gJianjie" placeholder="简介" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gJianjie_en_div" style="display: none">
                        <label class="layui-form-label" >英语简介:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gJianjie_en" id="gJianjie_en" placeholder="英语简介" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gJianjie_tai_div" >
                        <label class="layui-form-label" >泰语简介:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gJianjie_tai" id="gJianjie_tai" required
                                   lay-verify="gJianjie"
                                   placeholder="泰语简介" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" id="gJianjie_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨简介:</label>
                        <div class="layui-input-block">
                            <input type="text" name="gJianjie_tai" id="gJianjie_kh" required
                                   lay-verify="gJianjie"
                                   placeholder="柬埔寨语简介" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" >上架:</label>
                        <div class="layui-input-block">
                            <select id="gStatus" name="gStatus" style="width: 200px">
                                <option value="1" >上架</option>
                                <option value="0" >下架</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item" id="gDetail_div" style="display: none">
                        <label class="layui-form-label" >中文详情:</label>
                        <div class="layui-input-block">
                            <script id="editor" type="text/plain" style="height:500px;margin: auto"></script>
                        </div>
                    </div>
                    <div class="layui-form-item" id="gDetail_en_div" style="display: none">
                        <label class="layui-form-label" >英文详情:</label>
                        <div class="layui-input-block">
                            <script id="editor_en" type="text/plain" style="height:500px;margin: auto"></script>
                        </div>
                    </div>
                    <div class="layui-form-item" id="gDetail_tai_div">
                        <label class="layui-form-label" >泰文详情:</label>
                        <div class="layui-input-block">
                            <script id="editor_tai" type="text/plain" style="height:500px;margin: auto"></script>
                        </div>
                    </div>
                    <div class="layui-form-item" id="gDetail_kh_div" style="display: none">
                        <label class="layui-form-label" >柬埔寨详情:</label>
                        <div class="layui-input-block">
                            <script id="editor_kh" type="text/plain" style="height:500px;margin: auto"></script>
                        </div>
                    </div>

<!--                    <div class="layui-form-item">-->
<!--                        <label class="layui-form-label">是否推荐:</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <select id="tuijian" name="tuijian">-->
<!--                                <option value="1">是</option>-->
<!--                                <option value="0">否</option>-->
<!--                            </select>-->
<!--                        </div>-->
<!--                    </div>-->

                    <div class="layui-form-item layui-layout-admin">
                        <div class="layui-input-block">
                            <div class="layui-footer" style="left: 0;">
                                <button class="layui-btn" id="btnUpdate" lay-filter="demo1" type="button"
                                        style="margin-left:10%;" >
                                    修改
                                </button>
                                <button class="layui-btn layui-btn-primary" type="reset" >重置</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="layui-col-md2 formbox">

    </div>
</div>
</body>
<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">这里写你的初始化内容</script>
<!-- 配置文件 -->
<script type="text/javascript" src="/admin/ueditor/1.4.3/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/admin/ueditor/1.4.3/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
</html>

<script>
    var $ = layui.$;
    var upload = layui.upload;
    var layedit = layui.layedit;
    var form    = layui.form;
    var tree = layui.tree
    var ue = UE.getEditor('editor');
    var ue_en = UE.getEditor("editor_en");
    var ue_tai = UE.getEditor("editor_tai");
    var ue_kh = UE.getEditor("editor_kh");
    window.localStorage.guige = null;

    function show_tips_grabprice(th) {
        layer.tips(
            "若不填抢购价，默认为0，表示没有抢购价。",
            th,
            {tips:[4, '#3595CC'],time:4000}
        );
    }

    //上传商品首页图
    layui.use('upload', function () {
        upload.render({
            elem: '#icon_div',
            url: "/admin/upload/uploadimg",
            auto: true,
            choose: function (obj) {
                var files = obj.pushFile();
                obj.preview(function (index, file, result) {
                    $('#icon').attr('src', result);
                });
            },
            done: function (res, index, upload) {
                fileName = res.data[0];
                $("#icon_input").val(res.data);
            },
            error: function () {
                return layer.msg('上传失败，请重试!');
            }
        });
    });

    function getParameter(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }

    form.render("select");
    var m = new Map();

    function clear_guige(index){
        if(index==0){
            window.localStorage.guige = null
            $("#guige_msg"+index).html("未填写")
        }else if(index==1){
            window.localStorage.guige1 = null
            $("#guige_msg"+index).html("not filled")
        }else{
            window.localStorage.guige2 = null
            $("#guige_msg"+index).html("ไม่ได้กรอก")
        }
        $("#guige_msg"+index).css("color" , "red")
        guige_msg = 1
    }

    var gid = getParameter("id");
    var gtypeid = getParameter("gtypeid");

    /*  获取商品信息  */
    $(function(){
        layer.load(2);
        $.ajax({
            url:'/goods/getGoodsById',
            data:{goodsID:gid},
            async:false,
            success:function(result)
            {
                var r = result.data;
                //名称
                $("#gName").val(r.gname);
                $("#gName_en").val(r.gname_en);
                $("#gName_tai").val(r.gname_tai);
                $("#gName_kh").val(r.gname_kh);
                //简介
                $("#gJianjie").val(r.gjianjie);
                $("#gJianjie_en").val(r.gjianjie_en);
                $("#gJianjie_tai").val(r.gjianjie_tai);
                $("#gJianjie_kh").val(r.gjianjie_kh);
                //详情
                ue.ready(function(){
                    //设置编辑器的内容
                    ue.setContent(r.gdetail);
                });
                ue_en.ready(function ( ) {
                    ue_en.setContent(r.gdetail_en);
                });
                ue_tai.ready(function ( ) {
                    ue_tai.setContent(r.gdetail_tai);
                });
                ue_tai.ready(function ( ) {
                    ue_kh.setContent(r.gdetail_kh);
                });
                //权重
                $("#weights").val(r.weights);
                //原价
                $("#originalPrice").val(r.originalPrice);
                $("#originalPrice_en").val(r.originalPrice_en);
                $("#originalPrice_tai").val(r.originalPrice_tai);
                $("#originalPrice_kh").val(r.originalPrice_kh);
                //销售价格
                $("#gPrice").val(r.gprice);
                $("#gPrice_en").val(r.gprice_en);
                $("#gPrice_tai").val(r.gprice_tai);
                $("#gPrice_kh").val(r.gprice_kh);
                //抢购价
                $("#grabPrice").val(r.grabPrice);
                $("#grabPrice_en").val(r.grabPrice_en);
                $("#grabPrice_tai").val(r.grabPrice_tai);
                $("#grabPrice_kh").val(r.grabPrice_kh);
                //抢购价单位
                $("#grabPriceDanwei").val(r.grabPriceDanwei);
                $("#grabPriceDanwei_en").val(r.grabPriceDanwei_en);
                $("#grabPriceDanwei_tai").val(r.grabPriceDanwei_tai);
                $("#grabPriceDanwei_kh").val(r.grabPriceDanwei_kh);
                //第二抢购价
                $("#grabPriceSecond").val(r.grabPriceSecond);
                $("#grabPriceSecond_en").val(r.grabPriceSecond_en);
                $("#grabPriceSecond_tai").val(r.grabPriceSecond_tai);
                $("#grabPriceSecond_kh").val(r.grabPriceSecond_kh);
                //第二抢购价单位
                $("#grabPriceSecondDanwei").val(r.grabPriceSecondDanwei);
                $("#grabPriceSecondDanwei_en").val(r.grabPriceSecondDanwei_en);
                $("#grabPriceSecondDanwei_tai").val(r.grabPriceSecondDanwei_tai);
                $("#grabPriceSecondDanwei_kh").val(r.grabPriceSecondDanwei_kh);
                //商品库存
                $("#gKucun").val(r.gkucun);
                //上下架
                $("#gStatus").val(r.gstatus);
                form.render("select");
                //产地
                $("#chandi").val(r.gchandi);
                $("#chandi_en").val(r.gchandi_en);
                $("#chandi_tai").val(r.gchandi_tai);
                $("#chandi_kh").val(r.gchandi_kh);
                //单位
                $("#gDanwei").val(r.gdanwei);
                $("#gDanwei_en").val(r.gdanwei_en);
                $("#gDanwei_tai").val(r.gdanwei_tai);
                $("#gDanwei_kh").val(r.gdanwei_kh);
                //品牌
                $("#gPinpai").val(r.gpinpai);
                $("#gPinpai_en").val(r.gpinpai_en);
                $("#gPinpai_tai").val(r.gpinpai_tai);
                $("#gPinpai_kh").val(r.gpinpai_kh);
                //商品类型
                $("#superior_id").val(r.goodsType.gname);
                //商品类型id
                $("#gtype").val(gtypeid);
                //商品图片
                var picture = r.gpicture!=null ? r.gpicture : "/image/no.jpg";
                var picture2 = r.gpicture!=null ? "/"+r.gpicture : "/image/no.jpg";
                $("#icon_input").val(picture);
                $("#icon").attr("src",picture2);


                window.localStorage.guige = r.guige;
                window.localStorage.guige1 = r.guige_en;
                window.localStorage.guige2 = r.guige_tai;
                window.localStorage.guige3 = r.guige_kh;
                check(0)

                var obj = [];
                $.ajax({
                    type: "get",
                    dataType: "json",
                    url: "/admin/GoodsType/select",
                    data: {x:2},
                    async: false,
                    success: (res) => {
                        if (res.code == 500) {
                            return;
                        }
                        obj = [res.data];

                        layui.use(['layer', 'tree'], function () {
                            var tree = layui.tree;
                            my_tree = tree.render({
                                elem: '#xx',
                                data: obj,
                                accordion:true,
                                click: function (obj) {
                                    var nodes = document.getElementsByClassName("layui-tree-txt");
                                    for (var i = 0; i < nodes.length; i++) {
                                        if (obj.data.title == "类型列表") {
                                            return;
                                        }
                                        if (nodes[i].innerHTML === obj.data.title) {
                                            nodes[i].style.color = "orange";
                                        } else {
                                            nodes[i].style.color = "#555";
                                        }
                                    }
                                    $("#superior_id").val(obj.data.title);
                                    $("#gtype").val(obj.data.id);
                                    form.render();
                                },
                                id: 'treeId',
                                showCheckbox: false,
                                onlyIconControl: true
                            });
                        });

                        window.setTimeout(function(){
                            var nodes = $(".layui-tree-set")
                            for(var i = 0 ; i< nodes.length ; i++) {
                                if($(nodes[i]).attr("data-id") == r.gtype) {
                                    $(nodes[i]).find(".layui-tree-txt").css("color" , 'orange')
                                    var txt = $(nodes[i]).find(".layui-tree-txt").html()
                                    $("#superior_id").val(txt)
                                    $("#gtype").val(r.gtype)
                                }
                            }
                        },500)
                    },
                    error: (err) => {
                        console.log("查询失败");
                    }
                });
                layer.closeAll();
            }
        })
    })

    /**
     * 1未填写
     * 2未完善
     * 3已完成
     * 4数据格式错误
     * 5库存和价格为非数字
     * @type {number}
     */
    var guige_msg = 1

    function edite_guige(index){
        $.ajax({
            url:"/guige/guiges?uid=0&type="+index ,
            success:function(res){
                if(res.code == 200) {
                    if(index==0){
                        if(isNull(window.localStorage.guige)) {
                            window.localStorage.guige = JSON.stringify({default_guiges:res.data})
                        }else{
                            var data = window.localStorage.guige
                            data = JSON.parse(data)
                            data["default_guiges"] = res.data
                            window.localStorage.guige = JSON.stringify(data)
                        }
                    }else if(index==1){
                        if(isNull(window.localStorage.guige1)) {
                            window.localStorage.guige1 = JSON.stringify({default_guiges:res.data})
                        }else{
                            var data = window.localStorage.guige1
                            data = JSON.parse(data)
                            data["default_guiges"] = res.data
                            window.localStorage.guige1 = JSON.stringify(data)
                        }
                    }else{
                        if(isNull(window.localStorage.guige2)) {
                            window.localStorage.guige = JSON.stringify({default_guiges:res.data})
                        }else{
                            var data = window.localStorage.guige2
                            data = JSON.parse(data)
                            data["default_guiges"] = res.data
                            window.localStorage.guige2 = JSON.stringify(data)
                        }
                    }

                    var ti="规格";
                    if(index==1){
                        ti="Specification";
                    }else if(index==2){
                        ti="ข้อมูลจำเพาะ"
                    }
                    layer.open({
                        type:2 ,
                        title:ti,
                        area:['1000px' , '500px'],
                        content:"../guige/index"+index+".html?uid=0&yuyan="+index,
                        cancel:function(){
                            check(index)
                        }
                    })
                }else{
                    layer.msg(res.msg)
                }
            } ,
            fail:function(err){
                layer.msg("网络异常")
            }
        })
    }

    /* 获取图片信息 */
    $(function(){
        layer.load(2);
        $.ajax({
            url:'/goodsImages/getGoodsImages',
            data:{gid:gid},
            async: true,
            success:function(result)
            {
                if (result.code==200)
                {
                    for (var i=0;i<result.data[0].length;i++)
                    {
                        var img = result.data[0][i].gpicture;
                        $("#image"+i).attr("src","/"+img);
                        $("#upload"+i).hide();
                        $("#del"+i).show();
                        m.set("upload"+i,img);
                        $("#del"+i).on("click", function () {
                            var index = this.id.substring(3,4);
                            $("#del" + index).hide();
                            $("#upload"+index).show();
                            $("#image" + index)[0].src="/image/no.jpg";
                            m.delete("upload"+index);
                        });
                    }
                    for (var i =0 ;i<result.data[1].length;i++){
                        var img = result.data[1][i].gpicture;
                        console.log(img);
                        i+=5;
                        $("#image"+i).attr("src","/"+img);
                        $("#upload"+i).hide();
                        $("#del"+i).show();
                        m.set("upload"+i,img);
                        $("#del"+i).on("click", function () {
                            var index = this.id.substring(3,4);
                            $("#del" + index).hide();
                            $("#upload"+index).show();
                            $("#image" + index)[0].src="/image/no.jpg";
                            m.delete("upload"+index);
                        });
                        i-=5;
                    }
                    for (var i =0 ;i<result.data[2].length;i++){
                        var img = result.data[2][i].gpicture;
                        i+=10;
                        $("#image"+i).attr("src","/"+img);
                        $("#upload"+i).hide();
                        $("#del"+i).show();
                        m.set("upload"+i,img);
                        $("#del"+i).on("click", function () {
                            var index = this.id.substring(3,5);
                            $("#del" + index).hide();
                            $("#upload"+index).show();
                            $("#image" + index)[0].src="/image/no.jpg";
                            m.delete("upload"+index);
                        });
                        i-=10;
                    }
                    for (var i =0 ;i<result.data[3].length;i++){
                        var img = result.data[3][i].gpicture;
                        i+=15;
                        $("#image"+i).attr("src","/"+img);
                        $("#upload"+i).hide();
                        $("#del"+i).show();
                        m.set("upload"+i,img);
                        $("#del"+i).on("click", function () {
                            var index = this.id.substring(3,5);
                            $("#del" + index).hide();
                            $("#upload"+index).show();
                            $("#image" + index)[0].src="/image/no.jpg";
                            m.delete("upload"+index);
                        });
                        i-=15;
                    }
                }
            }
        });
        layer.closeAll();
    });

    function walkinto(item,index){
        for(var i in item) {
            if(isNull(item[i].name)) {
                guige_msg = 2
                if(index==0){
                    $("#guige_msg"+index).html("未完善")
                }else if(index==1){
                    $("#guige_msg"+index).html("Not Perfection")
                }else{
                    $("#guige_msg"+index).html("ไม่สมบูรณ์แบบ")
                }
                $("#guige_msg"+index).css("color" , "red")
                flag = false
                return false
            }
            if(item[i].children.length != 0) {
                return walkinto(item[i].children,index)
            }
        }
        return true
    }

    function check(index){
        var data;
        if(index==0){
            data = window.localStorage.guige;
        }else if(index==1){
            data = window.localStorage.guige1;
        }else{
            data = window.localStorage.guige2;
        }
        if(isNull(data)) {
            if(index==0){
                $("#guige_msg"+index).html("未填写")
            }else if(index==1){
                $("#guige_msg"+index).html("not filled")
            }else{
                $("#guige_msg"+index).html("ไม่ได้กรอก")
            }
            $("#guige_msg"+index).css("color" , "red")
            guige_msg = 1
            return
        }
        data = JSON.parse(data)
        var values = data.values
        if(values != null) {
            try{
                var flag = true
                if(!walkinto(values,index)) {
                    return
                }
                for(var i in values) {
                    if(isNull(values[i].img)) {
                        guige_msg = 2
                        if(index==0){
                            $("#guige_msg"+index).html("未完善")
                        }else if(index==1){
                            $("#guige_msg"+index).html("Not Perfection")
                        }else{
                            $("#guige_msg"+index).html("ไม่สมบูรณ์แบบ")
                        }
                        $("#guige_msg"+index).css("color" , "red")
                        flag = false
                        break
                    }
                }

                if(flag) {
                    guige_msg = 3
                    if(index==0){
                        $("#guige_msg"+index).html("已完成")
                    }else if(index==1){
                        $("#guige_msg"+index).html("completed")
                    }else{
                        $("#guige_msg"+index).html("เสร็จแล้ว")
                    }
                    $("#guige_msg"+index).css("color" , "green")
                }
            }catch(err){
                guige_msg = 4
                if(index==0){
                    $("#guige_msg"+index).html("格式异常")
                }else if(index==1){
                    $("#guige_msg"+index).html("Abnormal format")
                }else{
                    $("#guige_msg"+index).html("ฟอร์มไม่ปกติ")
                }
                $("#guige_msg"+index).css("color" , "red")
            }
        }
    }

    check(0)

    function isNull(str){
        if(str == "" || str == null || str == undefined || str == "null" || str == "undefined") {
            return true
        }
        return false
    }

    function isNum(str){
        return /\d+/.test(str)
    }

    function uploadCommers(id, array) {
        var fileId = "";
        var uploadInst = upload.render({
            elem: '#' + id //绑定元素
            , url: '/admin/upload/uploadimg'
            , auto: true //选择文件后不自动上传
            , multiple: false
            // ,bindAction: '#fileAction'
            , before: function (obj) {
                //读取本地文件
                obj.preview(function (index, file, result) {
                    var index1 = id.substring(6,8);
                    var tr = $("#image" + index1).attr("src", result);
                    $("#" + id).hide();
                    $("#del" + index1).show();

                    $("#del" + index1).on("click", function () {
                        $("#del" + index1).hide();
                        $("#"+id).show();
                        $("#image" + index1)[0].src="/image/no.jpg";
                        m.delete(id);
                    });
                });
            }
            , allDone: function (obj) { //当文件全部被提交后，才触发

            }
            , done: function (res, index, upload) {
                if (res.code == 0) { //上传成功
                    //array[id]=res.data;
                    m.set(id,res.data);
                }
            }
            , error: function (res, index, upload) {
                console.log("error");
            }
        });
    }

    var arry = [];
    for (var k=0;k<20;k++)
    {
        var id  ="upload"+k;
        uploadCommers(id, arry);
    }

    $("#btnUpdate").click(function () {
        // //是否推荐
        // var tuijian = $("#tuijian").val();
        //名称
        var gName = $("#gName").val();
        var gName_en = $("#gName_en").val();
        var gName_tai = $("#gName_tai").val();
        var gName_kh = $("#gName_kh").val();
        //简介
        var jianjie = $("#gJianjie").val();
        var jianjie_en = $("#gJianjie_en").val();
        var jianjie_tai = $("#gJianjie_tai").val();
        var jianjie_kh = $("#gJianjie_kh").val();
        //详情
        var gDetail =  ue.getContent();
        var gDetail_en =  ue_en.getContent();
        var gDetail_tai =  ue_tai.getContent();
        var gDetail_kh =  ue_kh.getContent();
        //销售价格
        var gPrice  = $("#gPrice").val();
        var gPrice_en  = $("#gPrice_en").val();
        var gPrice_tai  = $("#gPrice_tai").val();
        var gPrice_kh  = $("#gPrice_kh").val();
        //原价
        var originalPrice = $("#originalPrice").val();
        var originalPrice_en = $("#originalPrice_en").val();
        var originalPrice_tai = $("#originalPrice_tai").val();
        var originalPrice_kh = $("#originalPrice_kh").val();
        //库存
        var gKucun = $("#gKucun").val();
        //权重
        var weights = $("#weights").val();
        //上下架
        var gStatus = $("#gStatus").val();
        //产地
        var gchandi = $("#chandi").val();
        var chandi_en = $("#chandi_en").val();
        var chandi_tai = $("#chandi_tai").val();
        var chandi_kh = $("#chandi_kh").val();
        //单位
        var gDanwei = $("#gDanwei").val();
        var gDanwei_en = $("#gDanwei_en").val();
        var gDanwei_tai = $("#gDanwei_tai").val();
        var gDanwei_kh = $("#gDanwei_kh").val();
        //品牌
        var gpinpai = $("#gPinpai").val();
        var gPinpai_en = $("#gPinpai_en").val();
        var gPinpai_tai = $("#gPinpai_tai").val();
        var gPinpai_kh = $("#gPinpai_kh").val();
        //商品图片
        var gPicture = $("#icon_input").val();
        //商品抢购价
        var grabPrice = $("#grabPrice").val();
        var grabPrice_en = $("#grabPrice_en").val();
        var grabPrice_tai = $("#grabPrice_tai").val();
        var grabPrice_kh = $("#grabPrice_kh").val();
        //第一抢购价单位
        var grabPriceDanwei = $("#grabPriceDanwei").val();
        var grabPriceDanwei_en = $("#grabPriceDanwei_en").val();
        var grabPriceDanwei_tai = $("#grabPriceDanwei_tai").val();
        var grabPriceDanwei_kh = $("#grabPriceDanwei_kh").val();
        //第二抢购价
        var grabPriceSecond = $("#grabPriceSecond").val();
        var grabPriceSecond_en = $("#grabPriceSecond_en").val();
        var grabPriceSecond_tai = $("#grabPriceSecond_tai").val();
        var grabPriceSecond_kh = $("#grabPriceSecond_kh").val();
        //第二抢购价单位
        var grabPriceSecondDanwei = $("#grabPriceSecondDanwei").val();
        var grabPriceSecondDanwei_en = $("#grabPriceSecondDanwei_en").val();
        var grabPriceSecondDanwei_tai = $("#grabPriceSecondDanwei_tai").val();
        var grabPriceSecondDanwei_kh = $("#grabPriceSecondDanwei_kh").val();

        var gtype = $("#gtype").val();

        var guige = window.localStorage.guige;

        if (weights==null || weights==""){
            layer.msg("请填写权重数字");
            return ;
        }

        if (weights<1 || weights>999999999){
            layer.msg("请重新填写权重数字");
            return ;
        }

        if (originalPrice==null ||originalPrice ==""){
            layer.msg("请填写人民币原价");
            return ;
        }

        if (originalPrice_tai==null || originalPrice_tai==""){
            layer.msg("请填写泰语原价");
            return ;
        }

        if (grabPrice!="" && grabPriceDanwei==""){
            layer.msg("请填写中文抢购价的单位");
            return ;
        }
        if (grabPrice_en!="" && grabPriceDanwei_en==""){
            layer.msg("请填写英文抢购价的单位");
            return ;
        }
        if (grabPrice_tai!="" && grabPriceDanwei_tai==""){
            layer.msg("请填写泰语抢购价的单位");
            return ;
        }
        if (grabPriceSecond!="" && grabPriceSecondDanwei==""){
            layer.msg("请填写中文第二抢购价的单位");
            return ;
        }
        if (grabPriceSecond_en!="" && grabPriceSecondDanwei_en==""){
            layer.msg("请填写英文第二抢购价的单位");
            return ;
        }
        if (grabPriceSecond_tai!="" && grabPriceSecondDanwei_tai==""){
            layer.msg("请填写泰语第二抢购价的单位");
            return ;
        }

        if (gPicture=="" || gPicture==null){
            layer.msg("请上传商品图片",{icon:2,time:1500});
        }
        if(gtype == "" || gtype == undefined || gtype == undefined) {
            layer.msg("商品类型不能为空",{icon:2,time:1500});
            return false;
        }
        if (gName=="")
        {
            layer.msg("商品名称不能为空",{icon:2,time:1500});
            return false;
        }
        if (jianjie=="")
        {
            layer.msg("中文简介不能为空",{icon:2,time:1500});
            return false;
        }
        if (jianjie_tai =="")
        {
            layer.msg("泰语简介不能为空",{icon:2,time:1500});
            return false;
        }
        if (chandi=="")
        {
            layer.msg("中文商品生产地不能为空",{icon:2,time:1500});
            return false;
        }
        if (jianjie_tai =="")
        {
            layer.msg("泰语商品生产地不能为空",{icon:2,time:1500});
            return false;
        }
        if (gDanwei=="")
        {
            layer.msg("中文计量单位不能为空",{icon:2,time:1500});
            return false;
        }
        if (gDanwei_tai =="")
        {
            layer.msg("泰语计量单位不能为空",{icon:2,time:1500});
            return false;
        }
        if (gPinpai=="")
        {
            layer.msg("中文品牌不能为空",{icon:2,time:1500});
            return false;
        }
        if (gPinpai_tai =="")
        {
            layer.msg("泰语品牌不能为空",{icon:2,time:1500});
            return false;
        }
        if (gPrice=="")
        {
            layer.msg("人民币价格不能为空",{icon:2,time:1500});
            return false;
        }
        if (gPrice_tai=="")
        {
            layer.msg("泰文版价格不能为空",{icon:2,time:1500});
            return false;
        }
        if (isNaN(gPrice))
        {
            layer.msg("销售价格只能是数字",{icon:2,time:1500});
            return false;
        }
        if (gPrice<0)
        {
            layer.msg("销售价格只能是正数",{icon:2,time:1500});
            return false;
        }
        if(guige_msg == 2 || guige_msg == 4 || guige_msg == 5) {
            layer.msg("规格"+$("#guige_msg").html())
            return
        }
        if (m.size<=0){
            layer.msg("请上传商品轮播图",{icon:2,time:1500});
            return ;
        }
        if (gKucun==""){
            layer.msg("请填写库存");
            return ;
        }

        if(!isNull(guige)) {
            guige = JSON.parse(guige)
            guige = JSON.stringify({values:guige.values , select_guiges:guige.select_guiges})
        }else{
            guige = null
        }
        layer.load(2);
        $.ajax({
            url:'/goods/goodsUpdate',
            sync:true,
            data:{grabPrice:grabPrice,grabPrice_en:grabPrice_en,grabPrice_tai:grabPrice_tai,grabPrice_kh:grabPrice_kh,gKucun:gKucun,guige:guige,gTypeId:gtype,id:gid,gName:gName,gPicture:gPicture,gJianjie:jianjie,gDetail:gDetail,gDetail_en:gDetail_en,gDetail_tai:gDetail_tai,gDetail_kh:gDetail_kh,gPrice:gPrice,gStatus:gStatus,gChandi:gchandi,gDanwei:gDanwei,gPinpai:gpinpai,gPrice_en:gPrice_en,gPrice_tai:gPrice_tai,gPrice_kh:gPrice_kh,
                gName_en:gName_en,gName_tai:gName_tai,gName_kh:gName_kh,gJianjie_en:jianjie_en,gJianjie_tai:jianjie_tai,gJianjie_kh:jianjie_kh,gChandi_en:chandi_en,gChandi_tai:chandi_tai,gChandi_kh:chandi_kh, gDanwei_en:gDanwei_en,gDanwei_tai:gDanwei_tai,gDanwei_kh:gDanwei_kh,gPinpai_en:gPinpai_en,gPinpai_tai:gPinpai_tai,gPinpai_kh:gPinpai_kh,grabPriceDanwei:grabPriceDanwei,grabPriceSecond:grabPriceSecond,grabPriceSecondDanwei:grabPriceSecondDanwei,grabPriceDanwei_en:grabPriceDanwei_en,
                grabPriceSecond_en:grabPriceSecond_en,grabPriceSecondDanwei_en:grabPriceSecondDanwei_en,grabPriceDanwei_tai:grabPriceDanwei_tai,grabPriceDanwei_kh:grabPriceDanwei_kh,grabPriceSecond_tai:grabPriceSecond_tai,grabPriceSecond_kh:grabPriceSecond_kh,grabPriceSecondDanwei_tai:grabPriceSecondDanwei_tai,grabPriceSecondDanwei_kh:grabPriceSecond_kh,weights:weights,originalPrice:originalPrice,originalPrice_en:originalPrice_en,originalPrice_tai:originalPrice_tai,originalPrice_kh:originalPrice_kh
                },
            success:function(result){
                if (result.code==200){
                    $.ajax({
                        url:'/goods/updateGoodsPicture',
                        type:'post',
                        data:{id:result.data.id,image0:m.get("upload0"),image1:m.get("upload1"),image2:m.get("upload2"),image3:m.get("upload3"),image4:m.get("upload4"),image5:m.get("upload5"),image6:m.get("upload6"),image7:m.get("upload7"),image8:m.get("upload8"),image9:m.get("upload9"),image10:m.get("upload10"),image11:m.get("upload11"),image12:m.get("upload12"),image13:m.get("upload13"),image14:m.get("upload14"),image15:m.get("upload15"),image16:m.get("upload16"),image17:m.get("upload17"),image18:m.get("upload18"),image19:m.get("upload19")},
                        success:function(result){
                            if(result.code==200){
                                layer.msg("修改成功",{icon:1,time:1000},function () {
                                    location = '/admin/goods/goodsList.html';
                                });
                            }else{
                                layer.msg("轮播图修改失败",{icon:1,time:2000},function () {
                                    window.location.reload();
                                });
                            }
                        }
                    })

                }else{
                    layer.msg(result.data,{icon:2,time:1500});
                }

            }
        });
        layer.closeAll();
    })

    function clickbtn(index) {
        yuyan=index;
        var btns=$("#btngroup").find("button");
        if(index==0){
            $("#gName_div").css("display","block");
            $("#gName_en_div").css("display","none");
            $("#gName_tai_div").css("display","none");
            $("#gName_kh_div").css("display","none");
            $("#chandi_div").css("display","block");
            $("#chandi_en_div").css("display","none");
            $("#chandi_tai_div").css("display","none");
            $("#chandi_kh_div").css("display","none");
            $("#gPinpai_div").css("display","block");
            $("#gPinpai_en_div").css("display","none");
            $("#gPinpai_tai_div").css("display","none");
            $("#gPinpai_kh_div").css("display","none");
            $("#gJianjie_div").css("display","block");
            $("#gJianjie_en_div").css("display","none");
            $("#gJianjie_tai_div").css("display","none");
            $("#gJianjie_kh_div").css("display","none");
            $("#price_div").css("display","block");
            $("#price_en_div").css("display","none");
            $("#price_tai_div").css("display","none");
            $("#price_kh_div").css("display","none");
            $("#grabPrice_div").css("display","block");
            $("#grabPrice_en_div").css("display","none");
            $("#grabPrice_tai_div").css("display","none");
            $("#grabPrice_kh_div").css("display","none");
            $("#grabPriceSecond_div").css("display","block");
            $("#grabPriceSecond_en_div").css("display","none");
            $("#grabPriceSecond_tai_div").css("display","none");
            $("#grabPriceSecond_kh_div").css("display","none");
            $("#gDetail_div").css("display","block");
            $("#gDetail_en_div").css("display","none");
            $("#gDetail_tai_div").css("display","none");
            $("#gDetail_kh_div").css("display","none");
            $("#uploadDiv").css("display","block");
            $("#uploadDiv_en").css("display","none");
            $("#uploadDiv_tai").css("display","none");
            $("#uploadDiv_kh").css("display","none");
            $("#yuanjia_div").css("display","block");
            $("#yuanjia_en_div").css("display","none");
            $("#yuanjia_tai_div").css("display","none");
            $("#yuanjia_kh_div").css("display","none");
        } else if(index==1){
            $("#gName_div").css("display","none");
            $("#gName_en_div").css("display","block");
            $("#gName_tai_div").css("display","none");
            $("#gName_kh_div").css("display","none");
            $("#chandi_div").css("display","none");
            $("#chandi_en_div").css("display","block");
            $("#chandi_tai_div").css("display","none");
            $("#chandi_kh_div").css("display","none");
            $("#gPinpai_div").css("display","none");
            $("#gPinpai_en_div").css("display","block");
            $("#gPinpai_tai_div").css("display","none");
            $("#gPinpai_kh_div").css("display","none");
            $("#gJianjie_div").css("display","none");
            $("#gJianjie_en_div").css("display","block");
            $("#gJianjie_tai_div").css("display","none");
            $("#gJianjie_kh_div").css("display","none");
            $("#price_div").css("display","none");
            $("#price_en_div").css("display","block");
            $("#price_tai_div").css("display","none");
            $("#price_kh_div").css("display","none");
            $("#grabPrice_div").css("display","none");
            $("#grabPrice_en_div").css("display","block");
            $("#grabPrice_tai_div").css("display","none");
            $("#grabPrice_kh_div").css("display","none");
            $("#grabPriceSecond_div").css("display","none");
            $("#grabPriceSecond_en_div").css("display","block");
            $("#grabPriceSecond_tai_div").css("display","none");
            $("#grabPriceSecond_kh_div").css("display","none");
            $("#gDetail_div").css("display","none");
            $("#gDetail_en_div").css("display","block");
            $("#gDetail_tai_div").css("display","none");
            $("#gDetail_kh_div").css("display","none");
            $("#uploadDiv").css("display","none");
            $("#uploadDiv_en").css("display","block");
            $("#uploadDiv_tai").css("display","none");
            $("#uploadDiv_kh").css("display","none");
            $("#yuanjia_div").css("display","none");
            $("#yuanjia_en_div").css("display","block");
            $("#yuanjia_tai_div").css("display","none");
            $("#yuanjia_kh_div").css("display","none");
        }else if(index==2){
            $("#gName_div").css("display","none");
            $("#gName_en_div").css("display","none");
            $("#gName_tai_div").css("display","block");
            $("#gName_kh_div").css("display","none");
            $("#chandi_div").css("display","none");
            $("#chandi_en_div").css("display","none");
            $("#chandi_tai_div").css("display","block");
            $("#chandi_kh_div").css("display","none");
            $("#gPinpai_div").css("display","none");
            $("#gPinpai_en_div").css("display","none");
            $("#gPinpai_tai_div").css("display","block");
            $("#gPinpai_kh_div").css("display","none");
            $("#gJianjie_div").css("display","none");
            $("#gJianjie_en_div").css("display","none");
            $("#gJianjie_tai_div").css("display","block");
            $("#gJianjie_kh_div").css("display","none");
            $("#price_div").css("display","none");
            $("#price_en_div").css("display","none");
            $("#price_tai_div").css("display","block");
            $("#price_kh_div").css("display","none");
            $("#grabPrice_div").css("display","none");
            $("#grabPrice_en_div").css("display","none");
            $("#grabPrice_tai_div").css("display","block");
            $("#grabPrice_kh_div").css("display","none");
            $("#grabPriceSecond_div").css("display","none");
            $("#grabPriceSecond_en_div").css("display","none");
            $("#grabPriceSecond_tai_div").css("display","block");
            $("#grabPriceSecond_kh_div").css("display","none");
            $("#gDetail_div").css("display","none");
            $("#gDetail_en_div").css("display","none");
            $("#gDetail_tai_div").css("display","block");
            $("#gDetail_kh_div").css("display","none");
            $("#uploadDiv").css("display","none");
            $("#uploadDiv_en").css("display","none");
            $("#uploadDiv_tai").css("display","block");
            $("#uploadDiv_kh").css("display","none");
            $("#yuanjia_div").css("display","none");
            $("#yuanjia_en_div").css("display","none");
            $("#yuanjia_tai_div").css("display","block");
            $("#yuanjia_kh_div").css("display","none");
        }else if (index==3){
            $("#gName_div").css("display","none");
            $("#gName_en_div").css("display","none");
            $("#gName_tai_div").css("display","none");
            $("#gName_kh_div").css("display","block");
            $("#chandi_div").css("display","none");
            $("#chandi_en_div").css("display","none");
            $("#chandi_tai_div").css("display","none");
            $("#chandi_kh_div").css("display","block");
            $("#gPinpai_div").css("display","none");
            $("#gPinpai_en_div").css("display","none");
            $("#gPinpai_tai_div").css("display","none");
            $("#gPinpai_kh_div").css("display","block");
            $("#gJianjie_div").css("display","none");
            $("#gJianjie_en_div").css("display","none");
            $("#gJianjie_tai_div").css("display","none");
            $("#gJianjie_kh_div").css("display","block");
            $("#price_div").css("display","none");
            $("#price_en_div").css("display","none");
            $("#price_tai_div").css("display","none");
            $("#price_kh_div").css("display","block");
            $("#grabPrice_div").css("display","none");
            $("#grabPrice_en_div").css("display","none");
            $("#grabPrice_tai_div").css("display","none");
            $("#grabPrice_kh_div").css("display","block");
            $("#grabPriceSecond_div").css("display","none");
            $("#grabPriceSecond_en_div").css("display","none");
            $("#grabPriceSecond_tai_div").css("display","none");
            $("#grabPriceSecond_kh_div").css("display","block");
            $("#gDetail_div").css("display","none");
            $("#gDetail_en_div").css("display","none");
            $("#gDetail_tai_div").css("display","none");
            $("#gDetail_kh_div").css("display","block");
            $("#uploadDiv").css("display","none");
            $("#uploadDiv_en").css("display","none");
            $("#uploadDiv_tai").css("display","none");
            $("#uploadDiv_kh").css("display","block");
            $("#yuanjia_div").css("display","none");
            $("#yuanjia_en_div").css("display","none");
            $("#yuanjia_tai_div").css("display","none");
            $("#yuanjia_kh_div").css("display","block");
        }
        for(let i=0;i<btns.length;i++){
            if(i==index){
                btns[i].setAttribute("class","layui-btn");
                continue;
            }
            btns[i].setAttribute("class","layui-btn layui-btn-primary");
        }
    }

</script>
